<template>
  <el-card shadow="never" class="aui-card--fill">
    <el-image style="width: 200px; height: 200px" src="/file/img?name=images/bg.jpg">
    </el-image>
    <el-divider></el-divider>
    <el-upload
      class="upload-demo"
      action="/file/upload"
      :on-preview="handlePreview"
      :on-remove="handleRemove"
      :file-list="fileList"
      list-type="picture"
    >
      <el-button size="small" type="primary">点击上传</el-button>
    </el-upload>
  </el-card>
</template>

<script>
export default {
  data() {
    return {
      fileList: [],
    };
  },
  methods: {
    handleRemove(file, fileList) {
      console.log(file, fileList);
      this.$http
        .delete("/file", {
          params: {
            fileInfo: file.response.data,
          },
        })
        .then(({ data: res }) => {
          this.$message({
            message: `${res.data}`,
            type: "success",
          });
        });
    },
    handlePreview(file) {
      console.log(file);
    },
  },
};
</script>

<style scoped></style>
